// 实现日期格式化函数
// 2020-04-21  yyy/mm/dd     2020/04/21
const dateFormat = (date, format) => {
    // console.log(Object.prototype.toString.call(date));
    // console.log(date.getDate() < 10 ? '0' + date.getDate : date.getDate);
    var day = date.getDate();
    day = day < 10 ? '0' + day : day;
    console.log(day);
    var month = date.getMonth() + 1;
    month = month < 10 ? '0' + month : month;
    console.log(month);
    var year = date.getFullYear();
    console.log(year);

    format = format.replace('yyyy', year);
    format = format.replace('mm', month);
    format = format.replace('dd', day);
    console.log(format);
}
dateFormat(new Date('2020-04-01'), 'yyyy/mm/dd');